<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var nas = ('blue,green,yellow,orange,purple');
        console.log(nas.replace(1, 3));
        console.log(nas.substr(4, 4));
        console.log(nas.split(','));
        var nast = ['blue', 'green', 'yellow', 'orange', 'purple'];
        var str = nast.join('-')
        console.log(str);
    </script>
</body>

</html>